package t4tools.edumpbucket.providers;

import java.util.LinkedHashMap;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class ViewContentProvider implements IStructuredContentProvider {

	private static LinkedHashMap<Integer, String> elements = new LinkedHashMap<Integer, String>();

	public static void addElement(String element) {
		if (element != null && element.trim().length() > 0) {
			Integer hashCode = Integer.valueOf(element.hashCode());
			if (!elements.containsKey(hashCode)) {
				elements.put(hashCode, element);
			}
		}
	}

	@Override
	public void inputChanged(Viewer v, Object oldInput, Object newInput) {
	}

	@Override
	public void dispose() {
	}

	@Override
	public Object[] getElements(Object parent) {
		return elements.values().toArray(new String[] {});
	}
}